#ifndef SkClipShape_DEFINED
#define SkClipShape_DEFINED

#include "include/core/SkRect.h"
#include "include/core/SkRRect.h"
#include "include/core/SkPath.h"

#include <variant>

// Do not move the order of variant
using SkClipShape = std::variant<std::monostate, SkRect, SkRRect, SkPath>;
inline SkRect GetClipShapeBounds(const SkClipShape& shape) {
    SkASSERT(!std::holds_alternative<std::monostate>(shape));
    if (std::holds_alternative<SkRect>(shape)) {
        return std::get<SkRect>(shape);
    } else if (std::holds_alternative<SkRRect>(shape)) {
        return std::get<SkRRect>(shape).getBounds();
    } else if (std::holds_alternative<SkPath>(shape)) {
        return std::get<SkPath>(shape).getBounds();
    } else {
        return SkRect::MakeEmpty();
    }
}

inline uint64_t GetClipShapeHash(const SkClipShape& shape) {
    DrawingHash hasher;
    if (std::holds_alternative<SkRect>(shape)) {
        hasher.push(std::get<SkRect>(shape));
    } else if (std::holds_alternative<SkRRect>(shape)) {
        hasher.push(std::get<SkRRect>(shape));
    } else if (std::holds_alternative<SkPath>(shape)) {
        hasher.push(std::get<SkPath>(shape).hash());
    } else {
    }
    return hasher.digest();
}
#endif